﻿using System;
using AutoLoL.Logic.Automation;
using AutoLoL.Logic.Exceptions;

namespace AutoLoL.Logic.Windows
{
    public class GameWindow : BaseWindow
    {
        private static readonly string[] GAME_WINDOW_NAMES = new string[] { "League of Legends (TM) Client" };
        private const string GAME_CLASS_NAME = "LeagueOfLegendsWindowClass";

        public GameWindow()
        {
            foreach (string window in GAME_WINDOW_NAMES)
            {
                Handle = Win32.FindWindow(GAME_CLASS_NAME, window);

                if (Handle != IntPtr.Zero)
                {
                    break;
                }
            }

            if (Handle == IntPtr.Zero)
            {
                throw new WindowNotFoundException("League of Legends");
            }
        }
    }
}
